//-----------------------------------------------------------------------
// <copyright file="tblOpicCodeService.cs" company="Cyvee">
//     Copyright ? Cyvee. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using Scb.Framework;
using Robot.Entities;
using Robot.Data;
    
namespace Robot.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class tblOpicCodeService
    {
        #region tblOpicCode

        public static void CreatetblOpicCode(tblOpicCode tblOpicCode)
        {            
            try
            {
                tblOpicCodeDAO tblOpicCodeDAO = new tblOpicCodeDAO();
                tblOpicCodeDAO.CreatetblOpicCode(tblOpicCode);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreatetblOpicCodeException, ex);
            }
        }        

        public static void UpdatetblOpicCode(tblOpicCode tblOpicCode)
        {            
            try
            {
                tblOpicCodeDAO tblOpicCodeDAO = new tblOpicCodeDAO();
                tblOpicCodeDAO.UpdatetblOpicCode(tblOpicCode);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdatetblOpicCodeException, ex);
            }
        }        

        public static void DeletetblOpicCode(string customerName, string customerBranch)
        {            
            try
            {
                tblOpicCodeDAO tblOpicCodeDAO = new tblOpicCodeDAO();
                tblOpicCodeDAO.DeletetblOpicCode(customerName, customerBranch);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeletetblOpicCodeException, ex);
            }
        }
        
        public static tblOpicCode GettblOpicCode(string customerName, string customerBranch)
        {            
            try
            {
                tblOpicCodeDAO tblOpicCodeDAO = new tblOpicCodeDAO();
                return tblOpicCodeDAO.GettblOpicCode(customerName, customerBranch);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblOpicCodeException, ex);
            }
        }                

        public static tblOpicCodeCollection GettblOpicCodeList(tblOpicCodeColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                tblOpicCodeDAO tblOpicCodeDAO = new tblOpicCodeDAO();
                return tblOpicCodeDAO.GettblOpicCodeList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblOpicCodeListException, ex);
            }
        }        

        public static tblOpicCodeCollection GettblOpicCodeList(tblOpicCodeColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                tblOpicCodeDAO tblOpicCodeDAO = new tblOpicCodeDAO();
                return tblOpicCodeDAO.GettblOpicCodeList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblOpicCodeListException, ex);
            }
        }        

        #endregion
    }
}